<?
if (isset($_GET['year']))
{
$year = $_GET['year'];
}
else
{
$year = strftime ("%Y");
}
if (isset($_GET['month']))
{
	if ($_GET['month']<10)
	{
	$temp = $_GET['month'];
	$temp = preg_replace("/0/","",$temp);
	$month = "0".$temp;
	unset($temp);
	}
	else
	{
	$month = $_GET['month'];
	}
}
else
{
$month = strftime ("%m");
}
if (isset($_GET['day']))
{
	if ($_GET['day']<10)
	{
	$temp=$_GET['day'];
	$temp = preg_replace("/0/","",$temp);
	$day = "0".$temp;
	unset($temp);
	}
	else
	{
	$day = $_GET['day'];
	}
}
else
{
$day = strftime ("%d");
}


if ($month > 08 and $month <10)
{
$dni = 30;
$month_name = "September";
}
if ($month > 07 and $month <10)
{
$dni = 31;
$month_name = "August";
}
switch($month)
{
	case 01;
	$month_name = "January";
	
	$dni=31;
	break;
	case 02;
	$month_name = "February";
	$dni=29;
	break;
	case 03;
	$month_name = "March";
	$dni=31;
	break;
	case 04;
	$month_name = "April";
	$dni=30;
	break;
	case 05;
	$month_name = "May";
	$dni=31;
	break;
	case 06;
	$month_name = "June";
	$dni=30;
	break;
	case 07;
	$month_name = "July";
	$dni=31;
	break;
	case 08;
	$month_name = "August";
	$dni=31;
	break;
	case 09;
	//$month_name = "September";
	//$dni=30;
	break;
	case 10;
	$month_name = "October";
	$dni=31;
	break;
	case 11;
	$month_name = "November";
	$dni=30;
	break;
	case 12;
	$month_name = "December";
	$dni=31;
	break;		
}

//echo $dni;
$ime_mesec["01"] = "January";
$ime_mesec["02"] = "February";
$ime_mesec["03"] = "March";
$ime_mesec["04"] = "April";
$ime_mesec["05"] = "May";
$ime_mesec["06"] = "June";
$ime_mesec["07"] = "July";
$ime_mesec["08"] = "August";
$ime_mesec["09"] = "September";
$ime_mesec["10"] = "October";
$ime_mesec["11"] = "November";
$ime_mesec["12"] = "December";
session_start();

$f_online = "online.txt"; // The file where the data is saved.
if( file_exists($f_online) )
{
  $logoutTime = 300;
  $IP = $REMOTE_ADDR;
  $users = 0;
  $res = "";
  $fp = fopen($f_online,"r");
  $t = time();
  $content = fread($fp,filesize($f_online));
  fclose($fp);
  $lineas = split("\n",$content);
  for( $i = 0; $i < count($lineas); $i++ )
  {
    $datos = split(":",$lineas[$i]);
    $n = $t - $logoutTime;
    if ($datos[0] != $IP && $datos[1] > ($n))
    {
      $res .= "$datos[0]:$datos[1]\n";
      $usuarios++;
    }
  }
  $res .= "$IP:$t\n";
  $users++;
  $fp = fopen($f_online,"w");
  fwrite ($fp,$res);
  fclose($fp);
}
// Copy the following text and paste it where you want the message appear.

if(file_exists("log/".$year."_".$month."_".$day.".bin"))
{
//$udari = fopen("log/".$year."_".$month."_".$day,"r");
//$hit=fread($udari,3);
$hit=filesize("log/".$year."_".$month."_".$day.".bin");
//fclose($udari);
}
else
{
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<head><title>Traffitor - ".$HTTP_SERVER_VARS['SERVER_NAME']."</title>\n";
echo "<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n";
echo "<meta HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">\n";
echo "<meta NAME=\"RESOURCE-TYPE\" CONTENT=\"DOCUMENT\">\n";
echo "<meta NAME=\"DISTRIBUTION\" CONTENT=\"GLOBAL\">\n";
echo "<meta NAME=\"AUTHOR\" CONTENT=\"Rusin Tsonev\">\n";
echo "<meta NAME=\"COPYRIGHT\" CONTENT=\"Copyright (c) 2003 by tSoNeV.com\">\n";
echo "<meta NAME=\"KEYWORDS\" CONTENT=\"Rusin Tsonev\">\n";
echo "<meta NAME=\"DESCRIPTION\" CONTENT=\"Traffitor - Traffic Monitor by Rusin Tsonev\">\n";
echo "<meta NAME=\"ROBOTS\" CONTENT=\"INDEX, FOLLOW\">\n";
echo "<meta NAME=\"REVISIT-AFTER\" CONTENT=\"15 DAYS\">\n";
echo "<meta NAME=\"RATING\" CONTENT=\"GENERAL\">\n";
echo "<style type=\"text/css\">@import url(\"style.css\"); </style></head><body bgcolor=#FEF3EA>";

echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=150 class=tiny align=center>Year ".$year." (";
$yearhits=$_SESSION['yearhits'];
echo $yearhits;
unset($yearhits);

$year_at_moment = strftime ("%Y");
$month_name_at_moment = strftime ("%B");
$day_week_at_moment = strftime ("%A");
$day_at_moment = strftime ("%d");
$hour_at_moment = strftime ("%H");
$minute_at_moment = strftime ("%M");
$second_at_moment = strftime ("%S");

if (file_exists("log/unique/year/$year_at_moment"))
{
$uniq = file("log/unique/year/$year_at_moment");
$uniqa = " (".$uniq[0].")";
}
echo ")$uniqa:</td><td class=tiny1>Statistics generated on: $year_at_moment  $month_name_at_moment  $day_at_moment / $day_week_at_moment / $hour_at_moment : $minute_at_moment : $second_at_moment - $users Users online at the moment!</td>";
unset($uniqa);
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=150 class=tiny align=center>Months of ".$year.":</td><td>";
for ($q = 01 ; $q<=12 ; $q++)
{
if ($q<10)
	{
	$q = "0".$q;
	}
if ($q==$month)
{

echo "<td class=tiny1 align=center><a href=?year=".$year."&month=".$q."&day=".$day." title=\"$ime_mesec[$q]\" class=tiny1>".$q;
echo "(";
for ($jm=01 ; $jm<=$dni ; $jm++)
{
	if ($jm<10)
	{
	$jm = "0".$jm;
	}
	
	if (file_exists("log/".$year."_".$q."_".$jm.".bin"))
	{
	$tmp=filesize("log/".$year."_".$q."_".$jm.".bin");
	$monthhits=$monthhits + $tmp;
	}
	
}
echo $monthhits;
$yearhits=$yearhits+$monthhits;
$jv[$q]=$monthhits;
unset($monthhits);
if (file_exists("log/unique/month/$q"))
{
$uniq = file("log/unique/month/$q");
$uniqa = "(".$uniq[0].")";
}
echo ")$uniqa";
unset($uniqa);
echo "</a></td>";
}
else
{
echo "<td class=tiny align=center><a href=?year=".$year."&month=".$q."&day=".$day." title=\"$ime_mesec[$q]\" class=tiny>".$q;
echo "(";
for ($jm=01 ; $jm<=$dni+2 ; $jm++)
{
	if ($jm<10)
	{
	$jm = "0".$jm;
	}
	
	if (file_exists("log/".$year."_".$q."_".$jm.".bin"))
	{
	$tmp=filesize("log/".$year."_".$q."_".$jm.".bin");
	$monthhits=$monthhits + $tmp;
	}
	
}
echo $monthhits;
$yearhits=$yearhits+$monthhits;
$jv[$q]=$monthhits;
unset($monthhits);
if (file_exists("log/unique/month/$q"))
{
$uniq = file("log/unique/month/$q");
$uniqa = "(".$uniq[0].")";
}
echo ")$uniqa";
unset($uniqa);
echo "</a></td>";
}
}
echo "</tr></table>";
$q=0;
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=150 class=tiny align=center>Days from ".$month_name.":</td><td>";
for ($q = 1 ; $q<=$dni ; ++$q)
{

	if ($q<10)
	{
	$q = "0".$q;
	}
if ($q==$day)
{
if (file_exists("log/".$year."_".$month."_".$q.".bin"))
	{
	$hitove = filesize("log/".$year."_".$month."_".$q.".bin");
	echo "<td class=tiny1 align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny1>".$q."(".$hitove.")"."</a></td>";
	}
else
	{
	$hitove = 0;
	echo "<td class=tiny1 align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny1>".$q."(".$hitove.")"."</a></td>";
	}
}
else
{
if (file_exists("log/".$year."_".$month."_".$q.".bin"))
	{
	$hitove = filesize("log/".$year."_".$month."_".$q.".bin");
	echo "<td class=tiny align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny>".$q."(".$hitove.")"."</a></td>";
	}
else
	{
	$hitove = 0;
	echo "<td class=tiny align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny>".$q."(".$hitove.")"."</a></td>";
	}
}
$jvc[$q]=$hitove;
$hitove=0;
}
echo "</tr></table>";
echo "<div class=center>There is no log for this day:$year/$month/$day  </div>";
}
//echo $separated;
if(file_exists("log/".$year."_".$month."_".$day.".log"))
{
$fail = fopen("log/".$year."_".$month."_".$day.".log" , "r");
while(!feof($fail))
{
do
{
$separated = fgets($fail,200000);
$j=$j+1;
list($dump,$hits,$cpu,$platform,$width,$height,$color,$language,$host,$url,$ref,$browser,$remadr,$remhos,$year,$month,$month_name,$day_week,$week,$day,$hour,$minute,$second,$day_of_year) = explode("|",$separated);
$arr_hits[$j]=$hits;
if ($width==1 and $browser!=$browser[$j-1] and $browser!=$browser[$j-2] and $browser!=$browser[$j-3])
{
$arr_width[$j]=$arr_width[$j-1];
$arr_height[$j]=$arr_height[$j-1];
$arr_cpu[$j]=$arr_cpu[$j-1];
$arr_platform[$j]=$arr_platform[$j-1];
$arr_color[$j]=$arr_color[$j-1];
$arr_language[$j]=$arr_language[$j-1];
$arr_host[$j]=$arr_host[$j-1];
$arr_browser[$j]=$browser;
$arr_remadr[$j]=$arr_remadr[$j-1];
$arr_remhos[$j]=$arr_remhos[$j-1];
$arr_year[$j]=$arr_year[$j-1];
$arr_month[$j]=$arr_month[$j-1];
$arr_month_name[$j]=$arr_month_name[$j-1];
$arr_day_week[$j]=$arr_day_week[$j-1];
$arr_week[$j]=$arr_week[$j-1];
$arr_day[$j]=$arr_day[$j-1];
$arr_day_of_year[$j]=$arr_day_of_year[$j-1];
$arr_hour[$j]=$hour;
$arr_minute[$j]=$minute;
$arr_second[$j]=$second;
$arr_ref[$j]=$ref;
$arr_url[$j]=$url;
}
else
{
$arr_cpu[$j]=$cpu;
$arr_platform[$j]=$platform;
$arr_width[$j]=$width;
$arr_height[$j]=$height;
$arr_color[$j]=$color;
$arr_language[$j]=$language;
$arr_host[$j]=$host;
$ide = preg_replace("/RUSIN40/","&",$ref);
$arr_ref[$j]=$ide;
$arr_browser[$j]=$browser;
$arr_remadr[$j]=$remadr;
$arr_remhos[$j]=$remhos;
$arr_year[$j]=$year;
$arr_month[$j]=$month;
$arr_month_name[$j]=$month_name;
$arr_day_week[$j]=$day_week;
$arr_week[$j]=$week;
$week = explode (".",$week);
$unique_visitor[$j]=$week[0];
$unique_num[$j]=$week[1];
$arr_day[$j]=$day;
$arr_hour[$j]=$hour;
$arr_minute[$j]=$minute;
$arr_second[$j]=$second;
$arr_day_of_year[$j]=$day_of_year;
$ide = preg_replace("/RUSIN40/","&",$url);
$arr_url[$j]=$ide;
}
}
while($j<=$hit);
}
fclose($fail);
}
else
{
$empty =1;
$tiny = "tiny";
//die("<div class=tiny>DUHH</div>");
}
$j=1;
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<head><title>Traffitor - ".$HTTP_SERVER_VARS['SERVER_NAME']."</title>\n";
echo "<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n";
echo "<meta HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">\n";
echo "<meta NAME=\"RESOURCE-TYPE\" CONTENT=\"DOCUMENT\">\n";
echo "<meta NAME=\"DISTRIBUTION\" CONTENT=\"GLOBAL\">\n";
echo "<meta NAME=\"AUTHOR\" CONTENT=\"Rusin Tsonev\">\n";
echo "<meta NAME=\"COPYRIGHT\" CONTENT=\"Copyright (c) 2003 by tSoNeV.com\">\n";
echo "<meta NAME=\"KEYWORDS\" CONTENT=\"Rusin Tsonev\">\n";
echo "<meta NAME=\"DESCRIPTION\" CONTENT=\"Traffitor - Traffic Monitor by Rusin Tsonev\">\n";
echo "<meta NAME=\"ROBOTS\" CONTENT=\"INDEX, FOLLOW\">\n";
echo "<meta NAME=\"REVISIT-AFTER\" CONTENT=\"15 DAYS\">\n";
echo "<meta NAME=\"RATING\" CONTENT=\"GENERAL\">\n";
echo "<style type=\"text/css\">@import url(\"style.css\"); </style>\n";
echo "<script language=\"javascript\" type=\"text/javascript\" src=\"images/item.js\"></script>\n";
echo "</head><body bgcolor=#FEF3EA>";
if ($empty <> 1)
{
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=150 class=tiny align=center>Year ".$year." (";
$yearhits=$_SESSION['yearhits'];
echo $yearhits;
unset($yearhits);

$year_at_moment = strftime ("%Y");
$month_name_at_moment = strftime ("%B");
$day_week_at_moment = strftime ("%A");
$day_at_moment = strftime ("%d");
$hour_at_moment = strftime ("%H");
$minute_at_moment = strftime ("%M");
$second_at_moment = strftime ("%S");

if (file_exists("log/unique/year/$year_at_moment"))
{
$uniq = file("log/unique/year/$year_at_moment");
$uniqa = " (".$uniq[0].")";
}
echo ")$uniqa:</td><td class=tiny1>Statistics generated on: $year_at_moment  $month_name_at_moment  $day_at_moment / $day_week_at_moment / $hour_at_moment : $minute_at_moment : $second_at_moment - $users Users online at the moment!";
unset($uniqa);
echo "</td>";
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=150 class=tiny align=center>Months of ".$year.":</td><td>";
for ($q = 01 ; $q<=12 ; $q++)
{
if ($q<10)
	{
	$q = "0".$q;
	}
if ($q==$month)
{
echo "<td class=tiny1 align=center><a href=?year=".$year."&month=".$q."&day=".$day." title=\"$ime_mesec[$q]\" class=tiny1>".$q;
echo "(";
for ($jm=01 ; $jm<=$dni ; $jm++)
{
	if ($jm<10)
	{
	$jm = "0".$jm;
	}
	
	if (file_exists("log/".$year."_".$q."_".$jm.".bin"))
	{
	$tmp=filesize("log/".$year."_".$q."_".$jm.".bin");
	$monthhits=$monthhits + $tmp;
	}
	
}
echo $monthhits;
$yearhits=$yearhits+$monthhits;
if (file_exists("log/unique/month/$q"))
{
$uniq = file("log/unique/month/$q");
$uniqa = "(".$uniq[0].")";
}
echo ")$uniqa";
unset($uniqa);
echo "</a></td>";
}
else
{
echo "<td class=tiny align=center><a href=?year=".$year."&month=".$q."&day=".$day." title=\"$ime_mesec[$q]\" class=tiny>".$q;
echo "(";
for ($jm=01 ; $jm<=$dni+1 ; $jm++)
{
	if ($jm<10)
	{
	$jm = "0".$jm;
	}
	
	if (file_exists("log/".$year."_".$q."_".$jm.".bin"))
	{
	$tmp=filesize("log/".$year."_".$q."_".$jm.".bin");
	$monthhits=$monthhits + $tmp;
	}
	
}
echo $monthhits;
$yearhits=$yearhits+$monthhits;
if (file_exists("log/unique/month/$q"))
{
$uniq = file("log/unique/month/$q");
$uniqa = "(".$uniq[0].")";
}
echo ")$uniqa";
unset($uniqa);
echo "</a></td>";
}
$jv[$q]=$monthhits;
unset($monthhits);
}
echo "</tr></table>";
//session_start();
//$_SESSION['yearhits']=$yearhits;
$q=0;
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=150 class=tiny align=center>Days from ".$month_name.":</td><td>";
for ($q = 1 ; $q<=$dni ; ++$q)
{

	if ($q<10)
	{
	$q = "0".$q;
	}
if ($q==$day)
{
if (file_exists("log/".$year."_".$month."_".$q.".bin"))
	{
	$hitove = filesize("log/".$year."_".$month."_".$q.".bin");
	echo "<td class=tiny1 align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny1>".$q."(".$hitove.")"."</a></td>";
	}
else
	{
	$hitove = 0;
	echo "<td class=tiny1 align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny1>".$q."(".$hitove.")"."</a></td>";
	}
	$jvc[$q]=$hitove;
}
else
{
if (file_exists("log/".$year."_".$month."_".$q.".bin"))
	{
	$hitove = filesize("log/".$year."_".$month."_".$q.".bin");
	echo "<td class=tiny align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny>".$q."(".$hitove.")"."</a></td>";
	}
else
	{
	$hitove = 0;
	echo "<td class=tiny align=center><a href=?year=".$year."&month=".$month."&day=".$q." title=\"Day:".$q." Hits:$hitove\" class=tiny>".$q."(".$hitove.")"."</a></td>";
	}
	$jvc[$q]=$hitove;
}
$hitove=0;
}
$shiro4ina = 758;
echo "</tr></table>";
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\"  height=500 bgcolor=#D5D5E1><tr><td width=\"765\" valign=top>";
echo "<DIV style=\"DISPLAY: block; OVERFLOW: auto; WIDTH: $shiro4ina; POSITION: relative; HEIGHT: 500 px\">";
echo "<table border=1 cellspacing=0 cellpadding=0 width=\"100%\" bgcolor=#E1D8CF>";
echo "<tr bgcolor=#D5D5E1>";
echo "<td align=center class=center>Visit#</td>";
echo "<td align=center class=center>Time of visit:</td>";
echo "<td align=center class=center><table border=0 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td align=center class=center>IP:</td></tr>";
echo "<tr><td align=center class=center>Name:</td></tr></table></td>";

echo "<td align=center class=center>User agent:</td>";
echo "<td align=center class=center>Screen res:<br>Available:</td>";
echo "<td align=center class=center>Color depth:</td>";
echo "<td align=center class=center>Platform:<br>CPU:</td>";
echo "<td align=center class=center>Language:</td>";
echo "<td align=center class=center><table border=0 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td align=center class=center>Coming from:</td></tr>";
echo "<tr><td align=center class=center>Looking at:</td></tr></table></td>";
echo "</tr>";
do
{
$j = $j+1;
if (!$unique_visitor[$j] == 1)
{
$tiny = "tiny";
}
else
{
$tiny = "tiny1";

}

if (!$unique_visitor[$j] == 1)
{
if (!$cvy4ka == 1)
	{
	if (!isset($cvy4ka))
	{
	$hide = "<div id=\"layerMore$unikalen_pored\"  style=\"DISPLAY: block;\" >" ;
	}
	else
	{
	$hide = "<div id=\"layerMore$unikalen_pored\"  style=\"DISPLAY: block;\" >" ;
	}
	$hide_end = "";
	$cvy4ka = 1;
	}
else
	{
	$hide = "" ;
	$hide_end = "";
	}
}
else
{

if ($arr_hits[$j] == 1)
{

$unikalen_pored = $j+1;
if (!$unique_visitor[$j+1] == 1 and isset($unique_visitor[$j+1]))
{
$arr_hits[$j] = ".:".$arr_hits[$j].":.";
$arr_hits[$j] = "<a href=\"#\" onclick=\"ToggleDisplay(Daybutton, layerMore$unikalen_pored)\" class=tiny><img src=\"images/minus.gif\" id=\"Daybutton\" border=0 align=left></a><br>".$arr_hits[$j]."<br><font class=\"off\">$unique_num[$j] visits</font>";
}
else
{
$arr_hits[$j] = ".:".$arr_hits[$j].":.";
$arr_hits[$j] = $arr_hits[$j]."<br><font class=\"off\">$unique_num[$j] visits</font>";
}
//$arr_hits[$j] = "<a href=\"#\" onclick=\"ToggleDisplay(Daybutton, layerMore$unikalen_pored)\" class=tiny><img src=\"images/minus.gif\" id=\"Daybutton\" border=0 align=left></a>".$arr_hits[$j]."<br>visited $unique_num[$j] times";
$hide = "";
$hide_end = "";
}
else
{
$arr_hits[$j] = ".:".$arr_hits[$j].":.";
$cvy4ka =0;
$unikalen_pored = $j+1;
if (!$unique_visitor[$j+1] == 1 and isset($unique_visitor[$j+1]))
{
$arr_hits[$j] = "<a href=\"#\" onclick=\"ToggleDisplay(Daybutton, layerMore$unikalen_pored)\" class=tiny><img src=\"images/minus.gif\" id=\"Daybutton\" border=0 align=left></a><br>".$arr_hits[$j]."<br><font class=\"off\">$unique_num[$j] visits</font>";
}
else
{
$arr_hits[$j] = $arr_hits[$j]."<br><font class=\"off\">$unique_num[$j] visits</font>";
}
$hide = "";
if ($unique_visitor[$j-1] == 1)
	{
	$hide_end = "";
	}
	else
	{
	$hide_end = "</div>";
	}
}
}

echo "</table>\n$hide_end\n$hide\n<table  cellspacing=1 cellpadding=0 bgcolor=#D5D5E1><tr>";
echo "<td class=".$tiny." align=center width=60>$arr_hits[$j]</td>";
echo "<td class=".$tiny." align=center width=50>$arr_hour[$j]:$arr_minute[$j]:$arr_second[$j]</td>";
echo "<td class=".$tiny." align=center width=240><table border=0 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td class=".$tiny." align=center><a href=\"http://www.samspade.org/t/lookat?a=$arr_remadr[$j]\" target=\"_blank\" class=\"".$tiny."\" title=\"Perform an IP Lookup for: $arr_remadr[$j]\" >$arr_remadr[$j]</a></td></tr>";
echo "<tr><td class=".$tiny." align=center><a href=\"http://www.samspade.org/t/lookat?a=$arr_remhos[$j]\" target=\"_blank\" class=\"".$tiny."\" title=\"Perform a DNS Lookup for: $arr_remhos[$j]\">$arr_remhos[$j]</a></td></tr></table></td>";

echo "<td class=".$tiny." align=center width=30>";

		if (preg_match ("/avant/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/avant.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/opera/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/opera.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/Konqueror/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/konqueror.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/netscape/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/ns.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/mac/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/mac.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/MSIE 6.0/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/ie.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/MSIE 4.0/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/ie4.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/MSIE 5.0/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/ie4.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/MSIE 5.1/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/ie.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/MSIE 5.5/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/ie.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/mozilla\/4/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/mozzila4.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		if (preg_match ("/mozilla\/5/i", $arr_browser[$j])) {
		print "<img src=\"images/browser/mozzila.gif\" border=0 title=\"$arr_browser[$j]\">";
		} else {
		print "<img src=\"images/browser/unknown.gif\" border=0 title=\"$arr_browser[$j]\">";
		}
		}
		}
		}
		}
		}
		}
		}
		}
		}
		}
		}
echo "</td>";
echo "<td class=".$tiny." align=center width=240>$arr_width[$j]<br>$arr_height[$j]</td>";
echo "<td class=".$tiny." align=center width=20>$arr_color[$j]</td>";
echo "<td class=".$tiny." align=center width=120>";

if (preg_match ("/win/i", $arr_platform[$j])) {
				if (preg_match ("/NT 5.1/i", $arr_browser[$j])) {
				$platform_img = "winxp.gif";
				$platform_title = "Windows XP/2000/NT";
				} else {
				$platform_img = "win98.gif";
				$platform_title = "Windows 98";
				}}
				else {
				if (preg_match ("/linux/i", $arr_browser[$j])) {
				$platform_img = "linux.gif";
				$platform_title = "Linux";
				} else {
				if (preg_match ("/bsd/i", $arr_browser[$j])) {
				$platform_img = "bsd.gif";
				$platform_title = "FreeBSD";
				} else {
				if (preg_match ("/mac/i", $arr_browser[$j])) {
				$platform_img = "mac.gif";
				$platform_title = "Mac/PPC";
				} else {
				if (preg_match ("/sunos/i", $arr_browser[$j])) {
				$platform_img = "sun.gif";
				$platform_title = "SunOS";
				} else {
				if (preg_match ("/irix/i", $arr_browser[$j])) {
				$platform_img = "irix.gif";
				$platform_title = "IRIX";
				} else {
				if (preg_match ("/beos/i", $arr_browser[$j])) {
				$platform_img = "beos.gif";
				$platform_title = "BeOS";
				} else {
				if (preg_match ("/os\/2/i", $arr_browser[$j])) {
				$platform_img = "os2.gif";
				$platform_title = "OS/2";
				} else {
				$platform_img = "unknown.gif";
				$platform_title = "Unknown?";
				}
				}
				}
				}
				}
				}
				}
				}
echo "<img src=\"images/os/$platform_img\" title=\"$platform_title : $arr_platform[$j]\" border=0>";

echo "<br>$arr_cpu[$j]</td>";
echo "<td class=".$tiny." align=center width=30>";

preg_match("/[^\.\/]+\.[^\.\/]+$/",$arr_remhos[$j],$matches);
									if (is_numeric($matches[0]))
										{
										if (preg_match ("/bg/i", $arr_language[$j])) {
										$flag = "bg";
										} else {
										if (preg_match ("/en/i", $arr_language[$j])) {
										$flag = "us";
										} else {
										if (preg_match ("/nl/i", $arr_language[$j])) {
										$flag = "nl";
										} else {
										if (preg_match ("/be/i", $arr_language[$j])) {
										$flag = "be";
										} else {
										if (preg_match ("/ru/i", $arr_language[$j])) {
										$flag = "ru";
										} else {
										if (preg_match ("/cz/i", $arr_language[$j])) {
										$flag = "cz";
										} else {
										if (preg_match ("/it/i", $arr_language[$j])) {
										$flag = "it";
										} else {
										if (preg_match ("/fr/i", $arr_language[$j])) {
										$flag = "fr";
										} else {
										if (preg_match ("/tr/i", $arr_language[$j])) {
										$flag = "tr";
										} else {
										if (preg_match ("/pl/i", $arr_language[$j])) {
										$flag = "pl";
										} else {
										if (preg_match ("/au/i", $arr_language[$j])) {
										$flag = "au";
										} else {
										if (preg_match ("/mx/i", $arr_language[$j])) {
										$flag = "mx";
										} else {
										if (preg_match ("/es/i", $arr_language[$j])) {
										$flag = "es";
										} else {
										if (preg_match ("/ro/i", $arr_language[$j])) {
										$flag = "ro";
										} else {
										if (preg_match ("/gr/i", $arr_language[$j])) {
										$flag = "gr";
										} else {
										if (preg_match ("/de/i", $arr_language[$j])) {
										$flag = "de";
										} else {
										$flag = "unknown";
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
										}
									else
									{
										$host = $matches[0];
										$Tnat = explode(".", $host);
									$flag=$Tnat[1];
									}
		switch($flag)
		{
			case "fr":
				$flag = "fr.gif"; break;
			case "tr":
				$flag = "tr.gif"; break;
			case "com":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "us.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "com.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
			case "":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "unknown.gif";break;
				}				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
			case "net":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "net.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "Net":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "net.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "NET":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "net.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "gr":
				$flag = "gr.gif"; break;
            case "biz":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "biz.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "pt":
				$flag = "pt.gif"; break;
            case "fi":
				$flag = "fi.gif"; break;
            case "id":
				$flag = "id.gif"; break;
            case "br":
				$flag = "br.gif"; break;
            case "dk":
				$flag = "dk.gif"; break;
            case "se":
				$flag = "se.gif"; break;
            case "mx":
				$flag = "mx.gif"; break;
            case "to":
				$flag = "to.gif"; break;
            case "cc":
				$flag = "cc.gif"; break;
            case "at":
				$flag = "at.gif"; break;
            case "sk":
				$flag = "sk.gif"; break;
            case "cz":
				$flag = "cz.gif"; break;
            case "edu":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "edu.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "no":
				$flag = "no.gif"; break;
            case "ua":
				$flag = "ua.gif"; break;
            case "tk":
				$flag = "tk.gif"; break;
            case "tv":
				$flag = "tv.gif"; break;
            case "ie":
				$flag = "ie.gif"; break;
            case "li":
				$flag = "li.gif"; break;
            case "il":
				$flag = "il.gif"; break;
            case "hr":
				$flag = "hr.gif"; break;
            case "za":
				$flag = "za.gif"; break;
            case "hu":
				$flag = "hu.gif"; break;
            case "mk":
				$flag = "mk.gif"; break;
            case "jp":
				$flag = "jp.gif"; break;
            case "gov":
				if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "gov.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "nu":
				$flag = "nu.gif"; break;
            case "ws":
				$flag = "ws.gif"; break;
            case "tw":
				$flag = "tw.gif"; break;
            case "ar":
				$flag = "ar.gif"; break;
            case "cx":
				$flag = "cx.gif"; break;
            case "fm":
				$flag = "fm.gif"; break;
            case "ve":
				$flag = "ve.gif"; break;
            case "lv":
				$flag = "lv.gif"; break;
            case "kr":
				$flag = "kr.gif"; break;
            case "lu":
				$flag = "lu.gif"; break;
            case "mt":
				$flag = "mt.gif"; break;
            case "yu":
				$flag = "yu.gif"; break;
            case "cn":
				$flag = "cn.gif"; break;
            case "cy":
				$flag = "cy.gif"; break;
            case "lt":
				$flag = "lt.gif"; break;
            case "in":
				$flag = "in.gif"; break;
            case "md":
				$flag = "md.gif"; break;
            case "sg":
				$flag = "sg.gif"; break;
            case "ae":
				$flag = "ae.gif"; break;
            case "am":
				$flag = "am.gif"; break;
            case "ee":
				$flag = "ee.gif"; break;
            case "tf":
				$flag = "tf.gif"; break;
            case "kz":
				$flag = "kz.gif"; break;
            case "az":
				$flag = "az.gif"; break;
            case "by":
				$flag = "by.gif"; break;
            case "cl":
				$flag = "cl.gif"; break;
            case "pf":
				$flag = "pf.gif"; break;
            case "kg":
				$flag = "kg.gif"; break;
            case "pe":
				$flag = "pe.gif"; break;
            case "al":
				$flag = "al.gif"; break;
            case "cr":
				$flag = "cr.gif"; break;
            case "do":
				$flag = "do.gif"; break;
            case "sv":
				$flag = "sv.gif"; break;
            case "hk":
				$flag = "hk.gif"; break;
            case "lb":
				$flag = "lb.gif"; break;
            case "th":
				$flag = "th.gif"; break;
            case "ma":
				$flag = "ma.gif"; break;
            case "org":
                if (preg_match ("/bg/i", $arr_language[$j])) {
				$flag = "bg.gif";break;
				} else {
				if (preg_match ("/en/i", $arr_language[$j])) {
				$flag = "uk.gif";break;
				} else {
				if (preg_match ("/nl/i", $arr_language[$j])) {
				$flag = "nl.gif";break;
				} else {
				if (preg_match ("/be/i", $arr_language[$j])) {
				$flag = "be.gif";break;
				} else {
				if (preg_match ("/ru/i", $arr_language[$j])) {
				$flag = "ru.gif";break;
				} else {
				if (preg_match ("/cz/i", $arr_language[$j])) {
				$flag = "cz.gif";break;
				} else {
				if (preg_match ("/it/i", $arr_language[$j])) {
				$flag = "it.gif";break;
				} else {
				if (preg_match ("/fr/i", $arr_language[$j])) {
				$flag = "fr.gif";break;
				} else {
				if (preg_match ("/tr/i", $arr_language[$j])) {
				$flag = "tr.gif";break;
				} else {
				if (preg_match ("/pl/i", $arr_language[$j])) {
				$flag = "pl.gif";break;
				} else {
				if (preg_match ("/au/i", $arr_language[$j])) {
				$flag = "au.gif";break;
				} else {
				if (preg_match ("/mx/i", $arr_language[$j])) {
				$flag = "mx.gif";break;
				} else {
				if (preg_match ("/es/i", $arr_language[$j])) {
				$flag = "es.gif";break;
				} else {
				if (preg_match ("/ro/i", $arr_language[$j])) {
				$flag = "ro.gif";break;
				} else {
				if (preg_match ("/gr/i", $arr_language[$j])) {
				$flag = "gr.gif";break;
				} else {
				if (preg_match ("/de/i", $arr_language[$j])) {
				$flag = "de.gif";break;
				} else {
				$flag = "org.gif";break;
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
				}
            case "ro":
                $flag = "ro.gif"; break;
			case "uk":
				$flag = "uk.gif"; break;
			case "nz":
				$flag = "nz.gif"; break;
			case "au":
				$flag = "au.gif"; break;
			case "es":
				$flag = "es.gif"; break;
			case "ch":
				$flag = "ch.gif"; break;
			case "pl":
				$flag = "pl.gif"; break;
			case "at":
				$flag = "us.gif"; break;
			case "us":
				$flag = "us.gif"; break;
			case "nl":
				$flag = "nl.gif"; break;
			case "hr":
				$flag = "hr.gif"; break;
			case "ru":
				$flag = "ru.gif"; break;
			case "it":
				$flag = "it.gif"; break;
			case "de":
				$flag = "de.gif"; break;
			case "dm":
				$flag = "dm.gif"; break;
			case "be":
				$flag = "be.gif"; break;
			case "ca":
				$flag = "ca.gif"; break;
			case "bg":
				$flag = "bg.gif"; break;
			default:
				$flag = "unknown.gif"; break;
		}
									echo "<img src=\"images/flags/$flag\" border=0 title=\"Language: $arr_language[$j]\">";

//echo $arr_language[$j];
echo "</td>";
echo "<td class=".$tiny." align=center><DIV style=\"DISPLAY: block; OVERFLOW: auto; WIDTH: 300; POSITION: relative\"><table border=0 cellspacing=0 cellpadding=0 width=\"100%\"><tr><td class=".$tiny." align=center width=27>";
if ($arr_ref[$j]=="")
{
echo "<img src=\"images/dead.gif\" title=\"Either bookmarked or typed in address bar\" border=0>";
}
else
{
//$arr_ref[$j] = ($arr_ref[$j]);
echo "<a href=$arr_ref[$j] class=".$tiny." target=\"_blank\"><img src=\"images/ref.gif\" title=\"Coming from: ".$arr_ref[$j]."\" border=0></a></td><td>";
}
echo "</td>";
echo "<td class=".$tiny." align=center width=27><a href=$arr_url[$j] class=".$tiny." target=\"_blank\"><img src=\"images/eye.gif\" title=\"Looking at: $arr_url[$j]\" border=0></a></td><td><a href=$arr_url[$j] class=".$tiny." target=\"_blank\">$arr_url[$j]</a></td></tr></table></div></td>";
echo "</tr>";
}
while($j<=$hit);
echo "</table>\n</div>\n</DIV>\n";
//$empty
}
else
{
$shiro4ina = 758;
echo "<table border=1 width=\"100%\" cellpadding=0 cellspacing=0 valign=top><tr><td width=$shiro4ina valign=top>";
}
//$empty
echo "<table border=1 width=$shiro4ina cellpadding=0 cellspacing=0 valign=top>";
echo "<tr>";
echo "<td width=175 height=80><a href=\"index.php\"><img src=\"images/traffitor.gif\" border=0 title=\"Traffitor - Traffic Monitor by Rusin Tsonev (c)\"></a></td>";

$bannedIP = $_GET['banned'];
$q = 0 ;
if (isset($_GET['banned']))
{
	if (file_exists("log/blocked/list"))
	{
	$ipfile = fopen ("log/blocked/list","r");
	while(!feof($ipfile))
		{
		$ipis[$q] = fgets ($ipfile,5000);
		$q++;
		}
	fclose($ipfile);
	$ipfile = fopen ("log/blocked/list","a");
	fwrite($ipfile,$bannedIP."\n");
	fclose($ipfile);
	}
	else
	{
	$ipfile = fopen ("log/blocked/list","a");
	fwrite($ipfile,$bannedIP."\n");
	fclose($ipfile);
	}
}
else
{
	if (file_exists("log/blocked/list"))
	{
	$ipfile = fopen ("log/blocked/list","r");
	while(!feof($ipfile))
		{
		$ipis[$q] = fgets ($ipfile,5000);
		$q++;
		}
	fclose($ipfile);
	}
}
$unban = $_GET['unban'];
if (isset($_GET['unban']))
{
	$ipfile = fopen ("log/blocked/list","r");
	$q=0;
	while(!feof($ipfile))
		{
		$ipis[$q] = fgets ($ipfile,5000);
		$q++;
		//echo $q;
		}
	fclose($ipfile);
	$ipfile = fopen ("log/blocked/list","w");
	$q = $q-1;
	for ($w=0 ; $w<$q ; $w++)
	{
		if ($ipis[$w] == $unban."\n")
		{
		}
		else
		{
		fwrite($ipfile,$ipis[$w]);
		}
	}
	fclose($ipfile);
}
echo "<td width=190 valign=top align=left class=tiny><form action=\"index.php\" mehod=\"post\" name=\"banned\" id=\"banned\">";
echo "<table border=1 width=\"100%\" cellspacing=1 cellpadding=2><tr><td class=tiny>Enter IP that you don't want to log:</td></tr></table>";
echo "<table border=1 width=\"100%\" cellspacing=1 cellpadding=2><tr><td class=tiny><input name=\"banned\" type=\"text\" id=\"banned\" value=".$HTTP_SERVER_VARS['REMOTE_ADDR']." size=\"24\" maxlength=\"16\">";
echo "<input type=\"hidden\" name=\"year\" value=\"$year\">";
echo "<input type=\"hidden\" name=\"month\" value=\"$month\">";
echo "<input type=\"hidden\" name=\"day\" value=\"$day\">";
echo "    <input type=submit name=Submit value=block>";
echo "</form></td></tr></table>";
echo "</td>";
echo "<td valign=top align=left class=tiny>";
if (isset($ipis[0]))
{
echo "<DIV style=\"DISPLAY: block; OVERFLOW: auto; WIDTH: 110; POSITION: relative; HEIGHT: 70 px\">";
echo "<table border=1 cellspacing=1 cellpadding=2 width=\"100%\"><tr><td class=tiny>Blocked IPs</td></tr></table>";
for ($ipita=0 ; $ipita < $q ; $ipita++)
{
echo "<table border=0 cellspacing=1 cellpadding=2 width=\"100%\"><tr><td class=tiny1><a href=\"?year=$year&month=$month&day=$day&unban=".$ipis[$ipita]."\" title=\"Unblock: ".$ipis[$ipita]."\" class=tiny1>".$ipis[$ipita]."</a></td></tr></table>";
}
echo "</DIV>";
}
echo "</td>";

//Hour Graphs
echo "<td width=280 height=70 valign=top align=left class=tiny>";

for ($opa = 0 ; $opa < 24 ; $opa++)
{
	if ($opa < 10)
	{
	if (file_exists("log/hourstats/0$opa"))
	{
	$hits_hour[$opa] = file("log/hourstats/0$opa");
	}
	else
	{
	$hits_hour[$opa] = 0;
	}
	}
	else
	{
	if (file_exists("log/hourstats/$opa"))
	{
	$hits_hour[$opa] = file("log/hourstats/$opa");
	}
	else
	{
	$hits_hour[$opa] = 0;
	}
	}
}
$opa = 0;
for ($opa = 0 ; $opa < 24 ; $opa++)
{
	if ($hits_hour[$opa][0] > $predishen)
	{
	$highest = $hits_hour[$opa][0];
	$predishen = $hits_hour[$opa][0];
	}
}
echo "<table width=280 height=10 border=1 cellpadding=0 cellspacing=0><tr width=280><td class=tiny1>Graphics by hours:</td></tr></table>";
echo "<table width=280 height=70 border=0 cellpadding=0 cellspacing=0><tr width=280>";
$hour_at_moment = strftime ("%H");
for ($opa = 0 ; $opa < 24 ; $opa++)
{
if ($hits_hour[$opa][0]==0)
{
$height=1;
//$hits_hour[$opa][0]=0;
}
else
{
//echo $highest;
$height=$hits_hour[$opa][0]/$highest*69;
$height=round($height);
//echo $height;
}
	if ($hour_at_moment == $opa)
	{
	echo "<td width=11 height=70 background=\"images/tb_b.gif\" align=center valign=bottom><img src=\"images/pixel2.gif\" border=0 width=9 height=\"$height\" title=\"Hour:$opa Hits:".$hits_hour[$opa][0]."\"></td>";
	}
	else
	{
	echo "<td width=11 height=70 background=\"images/tb_b.gif\" align=center valign=bottom><img src=\"images/pixel.gif\" border=0 width=9 height=\"$height\" title=\"Hour:$opa Hits:".$hits_hour[$opa][0]."\"></td>";
	}
}
echo "</tr><tr width=280>";
for ($opa = 0 ; $opa < 24 ; $opa++)
{
if ($hour_at_moment == $opa)
	{
	echo "<td class=tiny3 height=11>$opa</td>";
	}
	else
	{
	echo "<td class=tiny3 height=11>$opa</td>";
	}
}
echo "</tr></table>";
echo "</td>";

echo "</tr>";
echo "</table>";
echo "</td><td valign=top align=center>";
echo "<table width=150 border=0 cellpadding=1 cellspacing=0><tr>";
$highest=0;
for ($q=1 ; $q<=$dni ; $q++)
{
	if ($q<10)
	{
	$q = "0".$q;
	}
if ($highest<$jvc[$q])
	{
	$highest=$jvc[$q];
	}
}
$width=150/$dni;
$width=round($width);
//echo $width;
for ($q=1 ; $q<=$dni ; $q++)
{
	if ($q<10)
	{
	$q = "0".$q;
	}
if ($jvc[$q]==0)
{$height=1;}
else
{
$height=$jvc[$q]/$highest*98;
$height=round($height);
}
//echo $heigest;
if($day == $q)
	{
	echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel2.gif\" width=$width height=$height title=\"Day viewing: ".$q." Hits:".$jvc[$q]." Percent:$height%\"></td>";
	}
else
	{
	echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height title=\"Day: ".$q." Hits:".$jvc[$q]." Percent:$height%\"></td>";
	}
}
echo "</tr></table>";
echo "<table width=100% border=1 cellpadding=1 cellspacing=0><tr><td class=".$tiny.">Graphics by days for $month_name</td></tr></table>";

//Graphs for month
echo "<table width=150 border=0 cellpadding=1 cellspacing=0><tr>";
for ($q=1 ; $q<=12 ; $q++)
{
	if ($q<10)
	{
	$q = "0".$q;
	}
if ($highest<$jv[$q])
{
$highest=$jv[$q];
}
}
$width=150/12+3;
$width=round($width);
//echo $width;
for ($q=1 ; $q<=12 ; $q++)
{
if ($q<10)
	{
	$q = "0".$q;
	}
if ($jv[$q]==0)
{
$height=1;
$jv[$q]=0;
}
else
{
$height=$jv[$q]/$highest*98;
$height=round($height);
}

//echo $jv[$q];
//echo $ime_mesec[$q];
if ($month == $q)
	{
	echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b1.gif\"><img src=\"images/pixel2.gif\" width=$width height=$height title=\"Month viewing: ".$ime_mesec[$q]." Hits:".$jv[$q]." Percent:$height%\"></td>";
	}
	else
	{
	echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b1.gif\"><img src=\"images/pixel1.gif\" width=$width height=$height title=\"Month: ".$ime_mesec[$q]." Hits:".$jv[$q]." Percent:$height%\"></td>";
	}
}
echo "</tr></table>";
echo "<table width=100% border=1 cellpadding=1 cellspacing=0><tr><td class=".$tiny.">Graphics by months for $year</td></tr></table>";
//Graphics for OS
if (file_exists("log/os/win98"))
{
	$win98 = filesize("log/os/win98");
}
else
{
	$win98 = 0;
}
if (file_exists("log/os/winxp"))
{
	$winxp = filesize("log/os/winxp");
}
else
{
	$winxp = 0;
}
	if ($winxp > $win98)
	{
	$highest = $winxp;
	}
	else
	{
	$highest = $win98;
	}
if (file_exists("log/os/linux"))
{
	$linux = filesize("log/os/linux");
}
else
{
	$linux = 0;
}
	if ($linux > $highest)
	{
	$highest = $linux;
	}
if (file_exists("log/os/bsd"))
{
	$bsd = filesize("log/os/bsd");
}
else
{
	$bsd = 0;
}
	if ($bsd > $highest)
	{
	$highest = $bsd;
	}
if (file_exists("log/os/mac"))
{
	$mac = filesize("log/os/mac");
}
else
{
	$mac = 0;
}
	if ($mac > $highest)
	{
	$highest = $mac;
	}
if (file_exists("log/os/sunos"))
{
	$sunos = filesize("log/os/sunos");
}
else
{
	$sunos = 0;
}
	if ($sunos > $highest)
	{
	$highest = $sunos;
	}
if (file_exists("log/os/irix"))
{
	$irix = filesize("log/os/irix");
}
else
{
	$irix = 0;
}
	if ($irix > $highest)
	{
	$highest = $irix;
	}
if (file_exists("log/os/os2"))
{
	$os2 = filesize("log/os/os2");
}
else
{
	$os2 = 0;
}
	if ($os2 > $highest)
	{
	$highest = $os2;
	}
if (file_exists("log/os/unknown"))
{
	$unknown = filesize("log/os/unknown");
}
else
{
	$unknown = 0;
}
	if ($unknown > $highest)
	{
	$highest = $unknown;
	}
	
$height_winxp=$winxp/$highest*98;
	$height_winxp=round($height_winxp);
$height_win98=$win98/$highest*98;
	$height_win98=round($height_win98);
$height_linux=$linux/$highest*98;
	$height_linux=round($height_linux);
$height_bsd=$bsd/$highest*98;
	$height_bsd=round($height_bsd);
$height_mac=$mac/$highest*98;
	$height_mac=round($height_mac);
$height_sunos=$sunos/$highest*98;
	$height_sunos=round($height_sunos);
$height_irix=$irix/$highest*98;
	$height_irix=round($height_irix);
$height_beos=$beos/$highest*98;
	$height_beos=round($height_beos);
$height_os2=$os2/$highest*98;
	$height_os2=round($height_os2);
$height_unknown=$unknown/$highest*98;
	$height_unknown=round($height_unknown);
$width = $width+3;
echo "<table width=150 border=0 cellpadding=1 cellspacing=0><tr>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_winxp title=\"Windows XP/2000/NT: ".$winxp." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_win98 title=\"Windows 98/ME: ".$win98." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_linux title=\"Linux: ".$linux." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_bsd title=\"FreeBSD: ".$bsd." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_mac title=\"Macintosh/PPC: ".$mac." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_sunos title=\"SunOS: ".$sunos." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_irix title=\"IRIX: ".$irix." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_beos title=\"BeOS: ".$beos." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_os2 title=\"OS/2: ".$os2." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_unknown title=\"Unknown: ".$unknown." hits\"></td>";
echo "</tr><tr>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/winxp.gif\" title=\"Windows XP/2000/NT\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/win98.gif\" title=\"Windows 98/ME\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/linux.gif\" title=\"Linux\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/bsd.gif\" title=\"FreeBSD\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/mac.gif\" title=\"Macintosh/PPC\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/sun.gif\" title=\"SunOS\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/irix.gif\" title=\"IRIX\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/beos.gif\" title=\"BeOS\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/os2.gif\" title=\"OS/2\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/unknown.gif\" title=\"Unknown\" border=0 ></td>";
echo "</tr>";
echo "</table>";
//Logs for browsers
if (file_exists("log/browser/avant"))
{
	$avant = filesize("log/browser/avant");
}
else
{
	$avant = 0;
}
if (file_exists("log/browser/opera"))
{
	$opera = filesize("log/browser/opera");
}
else
{
	$opera = 0;
}
	if ($opera > $avant)
	{
	$highest = $opera;
	}
	else
	{
	$highest = $avant;
	}
if (file_exists("log/browser/konqueror"))
{
	$konqueror = filesize("log/browser/konqueror");
}
else
{
	$konqueror = 0;
}
	if ($konqueror > $highest)
	{
	$highest = $konqueror;
	}
if (file_exists("log/browser/netscape"))
{
	$netscape = filesize("log/browser/netscape");
}
else
{
	$netscape = 0;
}
	if ($netscape > $highest)
	{
	$highest = $netscape;
	}
if (file_exists("log/browser/mac"))
{
	$mac = filesize("log/browser/mac");
}
else
{
	$mac = 0;
}
	if ($mac > $highest)
	{
	$highest = $mac;
	}
if (file_exists("log/browser/ie4"))
{
	$ie4 = filesize("log/browser/ie4");
}
else
{
	$ie4 = 0;
}
	if ($ie4 > $highest)
	{
	$highest = $ie4;
	}
if (file_exists("log/browser/ie"))
{
	$ie = filesize("log/browser/ie");
}
else
{
	$ie = 0;
}
	if ($ie > $highest)
	{
	$highest = $ie;
	}
if (file_exists("log/browser/mozilla4"))
{
	$mozilla4 = filesize("log/browser/mozilla4");
}
else
{
	$mozilla4 = 0;
}
	if ($mozilla4 > $highest)
	{
	$highest = $mozilla4;
	}
if (file_exists("log/browser/mozilla5"))
{
	$mozilla5 = filesize("log/browser/mozilla5");
}
else
{
	$mozilla5 = 0;
}
	if ($mozilla5 > $highest)
	{
	$highest = $mozilla5;
	}
if (file_exists("log/browser/unknown"))
{
	$unknown = filesize("log/browser/unknown");
}
else
{
	$unknown = 0;
}
	if ($unknown > $highest)
	{
	$highest = $unknown;
	}
	
$height_avant=$avant/$highest*98;
	$height_avant=round($height_avant);
$height_opera=$opera/$highest*98;
	$height_opera=round($height_opera);
$height_konqueror=$konqueror/$highest*98;
	$height_konqueror=round($height_konqueror);
$height_netscape=$netscape/$highest*98;
	$height_netscape=round($height_netscape);
$height_mac=$mac/$highest*98;
	$height_mac=round($height_mac);
$height_ie=$ie/$highest*98;
	$height_ie=round($height_ie);
$height_ie4=$ie4/$highest*98;
	$height_ie4=round($height_ie4);
$height_mozilla4=$mozilla4/$highest*98;
	$height_mozilla4=round($height_mozilla4);
$height_mozilla5=$mozilla5/$highest*98;
	$height_mozilla5=round($height_mozilla5);
$height_unknown=$unknown/$highest*98;
	$height_unknown=round($height_unknown);
//$width = $width+2;
echo "<table width=150 border=0 cellpadding=1 cellspacing=0><tr>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_avant title=\"Avant Browser: ".$avant." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_opera title=\"Opera: ".$opera." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_konqueror title=\"Konqueror: ".$konqueror." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_netscape title=\"Netscape: ".$netscape." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_mac title=\"Macintosh/PPC: ".$mac." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_ie title=\"Microsoft Internet Explorer 5/6: ".$ie." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_ie4 title=\"Microsoft Internet Explorer 4/other: ".$ie4." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_mozilla4 title=\"Mozilla 4: ".$mozilla4." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_mozilla5 title=\"Mozilla 5: ".$mozilla5." hits\"></td>";
echo "<td valign=bottom align=center width=$width height=100  background=\"images/tb_b.gif\"><img src=\"images/pixel.gif\" width=$width height=$height_unknown title=\"Unknown: ".$unknown." hits\"></td>";
echo "</tr><tr>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/avant.gif\" width=14 height=14 title=\"Avant Browser\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/opera.gif\" width=14 height=14 title=\"Opera\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/konqueror.gif\" width=14 height=14 title=\"Konqueror\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/ns.gif\" width=14 height=14 title=\"Netscape\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/mac.gif\" width=14 height=14 title=\"Macintosh/PPC\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/ie.gif\" width=14 height=14 title=\"Microsoft Internet Explorer 5/6\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/ie4.gif\" width=14 height=14 title=\"Microsoft Internet Explorer 4/other\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/mozzila4.gif\" width=14 height=14 title=\"Mozilla 4\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/browser/mozzila.gif\" width=14 height=14 title=\"Mozilla 5\" border=0 ></td>";
echo "<td valign=bottom align=center width=$width height=14  class=".$tiny."><img src=\"images/os/unknown.gif\" width=14 height=14 title=\"Unknown\" border=0 ></td>";
echo "</tr>";
echo "</table>";
//Log Screen Resolution
//Logs for browsers
if (file_exists("log/res/640"))
{
	$res640 = filesize("log/res/640");
}
else
{
	$res640 = 0;
}
if (file_exists("log/res/800"))
{
	$res800 = filesize("log/res/800");
}
else
{
	$res800 = 0;
}
	if ($res800 > $res640)
	{
	$highest = $res800;
	}
	else
	{
	$highest = $res640;
	}
if (file_exists("log/res/1024"))
{
	$res1024 = filesize("log/res/1024");
}
else
{
	$res1024 = 0;
}
	if ($res1024 > $highest)
	{
	$highest = $res1024;
	}
if (file_exists("log/res/1152"))
{
	$res1152 = filesize("log/res/1152");
}
else
{
	$res1152 = 0;
}
	if ($res1152 > $highest)
	{
	$highest = $res1152;
	}
if (file_exists("log/res/1280"))
{
	$res1280 = filesize("log/res/1280");
}
else
{
	$res1280 = 0;
}
	if ($res1280 > $highest)
	{
	$highest = $res1280;
	}
if (file_exists("log/res/1600"))
{
	$res1600 = filesize("log/res/1600");
}
else
{
	$res1600 = 0;
}
	if ($res1600 > $highest)
	{
	$highest = $res1600;
	}
if (file_exists("log/res/unknown"))
{
	$unknown = filesize("log/res/unknown");
}
else
{
	$unknown = 0;
}
	if ($unknown > $highest)
	{
	$highest = $unknown;
	}
	
$height_640=$res640/$highest*98;
	$height_640=round($height_640);
	$height_640=$height_640."%";
$height_800=$res800/$highest*98;
	$height_800=round($height_800);
	$height_800=$height_800."%";
$height_1024=$res1024/$highest*98;
	$height_1024=round($height_1024);
	$height_1024=$height_1024."%";
$height_1152=$res1152/$highest*98;
	$height_1152=round($height_1152);
	$height_1152=$height_1152."%";
$height_1280=$res1280/$highest*98;
	$height_1280=round($height_1280);
	$height_1280=$height_1280."%";
$height_1600=$res1600/$highest*98;
	$height_1600=round($height_1600);
	$height_1600=$height_1600."%";
$height_unknown=$unknown/$highest*98;
	$height_unknown=round($height_unknown);
	$height_unknown=$height_unknown."%";
$width = 10;
echo "<table width=\"210\" border=0 cellpadding=1 cellspacing=0 align=center>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=tiny1> 640x480 </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_640 height=$width title=\"Screen Resolution 640x480: ".$res640." hits\"></td></tr>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=".$tiny."> 800x600 </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_800 height=$width title=\"Screen Resolution 800x600: ".$res800." hits\"></td></tr>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=tiny1> 1024x768 </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_1024 height=$width title=\"Screen Resolution 1024x768: ".$res1024." hits\"></td></tr>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=".$tiny."> 1152x864 </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_1152 height=$width title=\"Screen Resolution 1152x864: ".$res1152." hits\"></td></tr>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=tiny1> 1280x1024 </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_1280 height=$width title=\"Screen Resolution 1280x1024: ".$res1280." hits\"></td></tr>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=".$tiny."> 1600x1200 </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_1600 height=$width title=\"Screen Resolution 1600x1200: ".$res1600." hits\"></td></tr>";
echo "<tr><td valign=bottom align=center width=75 height=14  class=tiny1> unknown </td><td valign=middle align=left width=135 height=$width  background=\"images/tb_b2.gif\"><img src=\"images/pixel1.gif\" width=$height_unknown height=$width title=\"Screen Resolution Unknown: ".$unknown." hits\"></td></tr>";
echo "<tr><td class=tiny></td><td class=tiny>copyright <a href=\"http://www.tsonev.com\" title=\"tSoNeV.com\" target=\"_blank\" class=\"tiny\"><font color=\"green\">t</font><font color=red>S</font><font color=aqua>o</font><font color=yellow>N</font><font color=purple>e</font><font color=orange>V.</font>com</font></a></td></tr>";
echo "</table>";


echo "</td></tr></table>";
echo "<table width=\"100%\" height=100 border=1 cellpadding=1 cellspacing=0 align=center><tr><td class=tiny1>Statistics by nationality:</td></tr><tr><td width=\"100%\" height=100 border=1 cellpadding=1 cellspacing=0 align=left >";

$flags = array ("fr","tr","gr","pt","fi","id","br","dk","se","mx","to","cc","at","sk","cz","no","ua","tk","tv","ie","li","il","hr","za","hu","mk","jp","nu","ws","tw","ar","cx","fm","ve","lv","kr","lu","mt","yu","cn","cy","lt","in","md","sg","ae","am","ee","tf","kz","az","by","cl","pf","kg","pe","al","cr","do","sv","hk","lb","th","ma","ro","uk","nz","au","es","ch","pl","at","us","nl","hr","ru","it","de","dm","be","ca","bg","unknown");

foreach ($flags as $newflag => $flag)
{

//$hits [0] = "";
//$hits [1] = "";
$faila = "log/country/$flag";
if (file_exists($faila))
	{
	$fail = file ($faila);
	//$hits[1] = $flag;
	$hits = $fail[0];
	
	//return $hits;
	


if (is_numeric($hits[0]))
{
$masiv[$s] = $hits;
if ($masiv[$s] > $masiv[$s-2])
{
$highestw = $masiv[$s];
}
$s++;
$masiv[$s] = $flag;
$s++;
}
}
unset($hits);
}
natsort ($masiv);
//print_r($masiv);
do
{
//echo $masiv[$we];
//echo $highestw;
$height = $masiv[$we]/$highestw*70;
$height=round($height);
//echo $height;
echo "
<table border=0  cellpadding=1 cellspacing=0  align=left>
<tr>
<td border=0 height=83 cellpadding=0 cellspacing=0 align=center background=\"images/tb_b.gif\" valign=bottom>
<div class=tiny4 align=center>$masiv[$we]<br></div><img src=\"images/pixel1.gif\"  height=\"$height\"  width=\"95%\" title=\"".$masiv[$we+1]." : ".$masiv[$we]." hits\">
</td>
</tr>
<tr>
<td height=17 class=tiny1><img src=\"images/flags/".$masiv[$we+1].".gif\" border=0 title=\"".$masiv[$we+1]." : ".$masiv[$we]." hits\">
</td></tr></table>";
$we = $we + 2;
}
while( $we < $s );


echo "</td></tr></table>";
echo "</body></html>";

function failexists($flag)
{
global $hits;
$hits [0] = "";
$hits [1] = "";
$faila = "log/country/$flag";
if (file_exists($faila))
	{
	$fail = file ($faila);
	$hits[1] = $flag;
	$hits[0] = $fail[0];
	
	return $hits;
	}
}
$_SESSION['yearhits']=$yearhits;
?>
